#ifndef __SERVER_H
#define __SERVER_H

#include "ae.h"

#define C_OK                    0
#define C_ERR                   -1

#define LOG_DEBUG 1
#define LOG_INFO 2
#define LOG_NOTICE 3
#define LOG_WARNING 4

/* Log levels */
#define LL_DEBUG 0
#define LL_VERBOSE 1
#define LL_NOTICE 2
#define LL_WARNING 3
#define LL_RAW (1<<10) /* Modifier to log without timestamp */

#define LOG_MAX_LEN    1024 /* Default maximum length of syslog messages.*/

#define CONFIG_MIN_HZ            1

struct redisServer {
    aeEventLoop* el;
};

extern struct redisServer server;


#ifdef __GNUC__
void _serverLog(int level, const char *fmt, ...)
    __attribute__((format(printf, 2, 3)));
#else
void _serverLog(int level, const char *fmt, ...);
#endif
void serverLogRaw(int level, const char *msg);

/* Use macro for checking log level to avoid evaluating arguments in cases log
 * should be ignored due to low level. */
#define serverLog(level, ...) do {\
        _serverLog(level, __VA_ARGS__);\
    } while(0)

#endif